package com.bitbank.smartdevice.ui

import android.os.Bundle
import com.bitbank.smartdevice.R
import com.bitbank.smartdevice.ui.base.BaseFragmentActivity
import com.qmuiteam.qmui.util.QMUIStatusBarHelper
import com.tuya.smart.sdk.TuyaUser


class MainActivity : BaseFragmentActivity() {

    override fun getContextViewId(): Int = R.id.udl_content_id

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        QMUIStatusBarHelper.setStatusBarLightMode(this)
        if(null == savedInstanceState) {
            val fragment = MainFragment()
            supportFragmentManager
                .beginTransaction()
                .add(contextViewId, fragment, fragment.javaClass.simpleName)
                .addToBackStack(fragment.javaClass.simpleName)
                .commit()
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        TuyaUser.getDeviceInstance().onDestroy()
    }
}
